package com.lithium.extractors;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.lithium.common.ActiveIngredient;

public class ActiveIngredientExtractor implements ResultSetExtractor {

	@Override
	public Object extractData(ResultSet arg0) throws SQLException,
			DataAccessException {
		
		ActiveIngredient ai = new ActiveIngredient();
		
		if (!arg0.equals(null)){
		ai.setAi_id(arg0.getInt(1));
		ai.setActive_ingredient(arg0.getString(2));
		ai.setLang_locale(arg0.getString(3));
		} else {
			ai = null;
		}
		return ai;
	}

}
